package com.nutransit;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.mylibrary.mylibrary.util.CommonCode;

public class Fragment_Home extends Fragment
{
	private View rootView;
	private Context context;

	private ImageView iv_cab_selection, iv_van_selection,iv_share_face_book,iv_share_twitter,iv_share_youtube,iv_share_instagram;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
	{
		rootView = inflater.inflate(R.layout.fragment_home, container, false);

		init_var(rootView);
		return rootView;
	}

	private void init_var(View rootView2)
	{
		context = getActivity();
		iv_cab_selection = (ImageView) rootView2.findViewById(R.id.iv_cab_selection);
		iv_van_selection = (ImageView) rootView2.findViewById(R.id.iv_van_selection);
		iv_share_face_book = (ImageView) rootView2.findViewById(R.id.iv_share_face_book);
		iv_share_twitter = (ImageView) rootView2.findViewById(R.id.iv_share_twitter);
		iv_share_youtube = (ImageView) rootView2.findViewById(R.id.iv_share_youtube);
		iv_share_instagram = (ImageView) rootView2.findViewById(R.id.iv_share_instagram);

		iv_cab_selection.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View arg0)
			{
				final FragmentTransaction ft = getFragmentManager().beginTransaction();
				ft.add(R.id.fLayout_Container, new Fragment_Cab_Route_selection(), "MyFragmentTag");
				ft.addToBackStack(null);
				ft.commit();
			}
		});
		iv_van_selection.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View arg0)
			{
				final FragmentTransaction ft = getFragmentManager().beginTransaction();
				ft.add(R.id.fLayout_Container, new Fragment_van_route_selection(), "MyFragmentTag");
				ft.addToBackStack(null);
				ft.commit();
			}
		});
		
		iv_share_face_book.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View arg0)
			{
				CommonCode.Open_Link_In_Browser("https://www.facebook.com/pages/NuTransit/793351750674882",context);
			}
		});
		iv_share_twitter.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View arg0)
			{
				CommonCode.Open_Link_In_Browser("https://twitter.com/nutransit",context);
			}
		});
		iv_share_youtube.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View arg0)
			{
				CommonCode.Open_Link_In_Browser("https://www.youtube.com/channel/UChU7nb7HhkCKC1SkYJxpiDw",context);
			}
		});
		iv_share_instagram.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View arg0)
			{
				CommonCode.Open_Link_In_Browser("http://instagram.com/nutransit",context);
			}
		});

	}
}
